//
//  NSData+BZSafe.h
//  BZFoundation
//
//  Created by 郭艺伟 on 2017/9/30.
//  Copyright © 2017年 郭艺伟. All rights reserved.
//

#import <Foundation/Foundation.h>
#ifndef BZDataSubDataWithRange
#define BZDataSubDataWithRange(data,range,subData)                         \
if (((range).location) >= 0 && (range).length > 0 && (range).location <= [(data) length] && NSMaxRange(range)<=[(data) length]) {                  \
(subData) = [(data) subdataWithRange:(range)];                          \
} else { \
(subData) = nil;\
}
#endif

#ifndef BZDataSetData
#define BZDataSetData(data,aData)                         \
if ((aData)) {                  \
[(data) setData:(aData)];                          \
}
#endif
@interface NSData (BZSafe)

@end
